<html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css">
dt {
  font-style: italic;
  margin-top: 15px;
  margin-bottom: 3px;
  margin-left: 0px;
  border-bottom: 1px dotted black;
}
dd {
  margin-left: 10px;
}
table {
  border-collapse:collapse;
  border: 1px solid black;
  margin-top: 7px;
}
th {
  border: 1px solid black;
  padding: 3 7 3 7;
}
td {
  border: 1px solid black;
  padding: 3 7 3 7;
}
</style></head><body><p><a name="astore"></a><b>astore</b> :
  store object reference in local variable : <a href="opcodes.html">index</a> : <a href="http://asm.objectweb.org/asm40/javadoc/user/org/objectweb/asm/MethodVisitor.html#visitInsn(int)">visitInsn()</a></p><dl><dt>Description</dt><dd>Pops <i xmlns="">objectref</i> (a reference to an object or array) off the stack
and stores it in local variable &lt;varnum&gt;. The astore instruction
takes a single parameter, &lt;varnum&gt;, an unsigned integer which indicates
which local variable is used. &lt;varnum&gt; must be a valid local variable
number in the current frame.</dd><dt>Example</dt><dd><pre>
aload 1    ; Push object reference in local variable 1 onto stack
astore 3	; and store it in local variable 3
</pre></dd><dt>Notes</dt><dd>astore can also be used to store a returnAddress in a local
variable. See the jsr instruction for more details.</dd><dt>See also</dt><dd><a href="ref-lstore.html">lstore</a> <a href="ref-.html"></a> <a href="ref-istore.html">istore</a> <a href="ref-.html"></a> <a href="ref-dstore.html">dstore</a> <a href="ref-.html"></a> <a href="ref-fstore.html">fstore</a> <a href="ref-.html"></a> <a href="ref-wide.html">wide</a> </dd><dt>Stack</dt><dd><table xmlns="">
<tr>
<td>
<b>Before </b>
</td>
<td><b>After</b></td></tr>
<tr>
<td>objectref</td>
<td>...</td></tr>
<tr>
<td>...</td>
<td>...</td></tr>
</table></dd><dt>Bytecode</dt><dd><table xmlns="">
<tr>
<td>
<b> Type </b>
</td>
<td><b>Description</b></td></tr>
<tr>
<td>
u1 
</td>
<td>astore
opcode = 0x3A (58)
</td></tr>
<tr>
<td>
u1 
</td>
<td>&lt;varnum&gt;</td></tr>
</table>
There
is also a wide format for this instruction, which supports access to
all local variables from 0 to 65535:
<table xmlns="">
<tr>
<td>
<b> Type </b>
</td>
<td><b>Description</b></td></tr>
<tr>
<td>u1</td>
<td>wide
opcode = 0xC4 (196)
</td></tr>
<tr>
<td>u1</td>
<td>astore
opcode = 0x3A (58)
</td></tr>
<tr>
<td>u2</td>
<td>&lt;varnum&gt;</td></tr>
</table></dd></dl></body></html>